<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>
<div class="span9">
    <?php $causa = $this->session->userdata('causa'); ?>
    <div class="breadcrumb">
        <h4 style="margin: 0px;"><?php echo $causa['caratula'] . ' - ' . $causa['nroExpediente']; ?></h4>
    </div>

    <?php echo get_message(); ?>
    <h2><?php echo $titulo; ?></h2>
    <div class="container-table">
        <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-hover table-bordered" id="example">
            <thead>
                <tr>
                    <th>Fecha </th>
                    <th>Título</th>
                    <th>Descripción</th>
                    <th>Acciones</th>
                </tr>
            </thead>
            <tbody>
                <?php
                if (!empty($listado)) {
                    $color = 'odd';
                    foreach ($listado as $novedad) {
                        $color = ( $color == 'odd') ? 'even' : 'odd';
                        ?>

                        <tr class="<?php echo $color; ?>">
                            <td><?php echo database_to_normal_date($novedad->fecha); ?></td>
                            <td><?php echo $novedad->titulo; ?></td>
                            <td><?php echo $novedad->descripcion; ?></td>
                            <td>
                                <a class="btn btn-small" href="<?php echo base_url('causas/novedades/editar/' . $novedad->id); ?>"><span class="icon-eye-open"></span> | <span class="icon-pencil"></span></a>
                                <a class="btn btn-small eliminar" href="#eliminar" role="button" data-toggle="modal" dbid="<?php echo $novedad->id; ?>"><span class="icon-remove"></span> Eliminar</a>
                            </td>
                        </tr>
                        <?php
                    }
                }
                ?>
            </tbody>
        </table>
    </div>
</div>

<?php echo form_hidden('idEstudio', ''); ?>

<script type="text/javascript">
    $('#confirmaeliminacion').live('click', function(){
        window.location = "<?php echo base_url('causas/novedades/eliminar'); ?>/" + $('input[name="idEstudio"]').val();
    });
    $('.eliminar').live('click', function(){
        $('input[name=idEstudio]').val($(this).attr('dbid'));
    });
</script>

<div class="modal toggle fade" id="eliminar" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
        <h3 id="myModalLabel">Eliminar</h3>
    </div>
    <div class="modal-body">
        <p>¿Está seguro?</p>
    </div>
    <div class="modal-footer">       
        <button id="confirmaeliminacion" class="btn btn-primary">Si</button>
        <button class="btn" data-dismiss="modal" aria-hidden="true">No</button>
    </div>
</div>